package com.Map集合.练习02;

import java.util.ArrayList;
import java.util.HashMap;

public class ArrayListAndHashMapDemo {
/*
{张飞=15, 赵云=16}
{小桥=16, 周瑜=15}
{司马懿=16, 曹操=15}
 */
    public static void main(String[] args) {
        //创建ArrayList集合对象
        ArrayList<HashMap<String,String>> hashMaps = new ArrayList<>();

        HashMap<String, String> stringStringHashMap = new HashMap<>();
        stringStringHashMap.put("张飞","15");
        stringStringHashMap.put("赵云","16");

        HashMap<String, String> stringStringHashMap1 = new HashMap<>();
        stringStringHashMap1.put("周瑜","15");
        stringStringHashMap1.put("小桥","16");

        HashMap<String, String> stringStringHashMap2 = new HashMap<>();
        stringStringHashMap2.put("曹操","15");
        stringStringHashMap2.put("司马懿","16");

        hashMaps.add(stringStringHashMap);
        hashMaps.add(stringStringHashMap1);
        hashMaps.add(stringStringHashMap2);


        //遍历
        for (HashMap<String, String> hashMap : hashMaps) {
            System.out.println(hashMap);
        }
    }
}
